<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>融资申请表</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">

    <meta name="description" content="Write an awesome description for your new site here. You can edit this line in _config.yml. It will appear in your document head meta (for Google search results) and in your feed.xml site description.
">
    <script src="js/lrz.mobile.min.js"></script>
    <link rel="stylesheet" href="lib/weui.min.css">
    <link rel="stylesheet" href="css/jquery-weui.css">
    <link rel="stylesheet" href="demos/css/demos.css">
    <link rel="stylesheet" href="css/common.css">
    <link rel="stylesheet" href="font/fontscss/iconfont.css">
    <script src="lib/jquery-2.1.4.js"></script>
    <script src="js/sq.js"></script>

    <style type="text/css">
        .weui-cells {
            font-size: 12px;
        }

        .icon_back {
            position: absolute;
            left: -1rem;
            top: 0.9rem;
            width: 0.5rem;
            height: 1.0rem;
            background: url(./images/icon-back.png);
            background-size: 0.5rem 1em;
            vertical-align: middle;
        }
    </style>
</head>
<body>
<header>
    <div class="weui-row weui-no-gutter">
        <div class="weui-col-33">
            <a href="javascript:history.go(-1)" class="icon pull-right"><i class="icon_back"></i></a>
        </div>
        <div class="weui-col-33">融资申请表</div>
        <div class="weui-col-33" id="ligin_icon">
        </div>
    </div>
</header>
<div class="weui-cells weui-cells_form">
    <form method="post" id="frmInfo">
        <!--<div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label"><font
                    color="red" >*</font>项目名称</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="text"  id="project_name" name="project_name"  placeholder="请输入项目名称">
            </div>
        </div>-->
        <div class="weui-cell">
            <div class="weui-cell__hd">
                <label for="" class="weui-label"><font
                        color="red">*</font>合同编号</label>
            </div>
            <div class="weui-cell__bd">
                <select class="weui-select" name="types" id="types" onchange="getImg()">
                    <option value="0">SCF-YSZK</option>
                    <option value="1">SCF-YFZK</option>
                    <option value="2">SCF-XYRZ</option>
                </select>
                <div id="name2">
                    <div>
                        <input class="weui-input" type="text" id="bh2" name="bh2" onchange="getName()">
                    </div>
                    <div style=" padding-top: 1.0rem;">
                        (
                        <input type="text" id="bh2s" name="bh2s"
                               style="border-top-style:none;border-right-style:none;border-left-style:none;width:38px;text-align:center;">
                        )号资金请款单
                    </div>
                </div>
                <div id="name">
                    [
                    <input type="text" id="year" name="year" onchange="getTime()"
                           style="border-top-style:none;border-right-style:none;border-left-style:none;width:38px;text-align:center">
                    年](
                    <input type="text" id="num1" name="num1"
                           style="border-top-style:none;border-right-style:none;border-left-style:none;width:40px;text-align:center">
                    )号(
                    <input type="text" id="num2" name="num2"
                           style="border-top-style:none;border-right-style:none;border-left-style:none;width:40px;text-align:center">
                    )号
                    <!-- <input class="weui-input" type="text"id="bh" name="bh" placeholder="请输入合同编号">-->
                </div>


            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label"><font
                    color="red">*</font>申请人</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="text" name="apply_man" id="apply_man" placeholder="请输入申请人">
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label"><font
                    color="red">*</font>资金使用起始时间</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="text" name="start_time" id="start_time" placeholder="请输入资金使用起始时间"
                       onchange="getFinanceCost()">
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label"><font
                    color="red">*</font>资金使用结束时间</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="text" name="end_time" id="end_time" placeholder="请输入资金使用结束时间"
                       onchange="getFinanceCost()">
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label"><font
                    color="red">*</font>使用部门</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="text" name="deptId" id="deptId" placeholder="请输入使用部门">
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label">&nbsp;使用中心</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="text" name="centerId" id="centerId" placeholder="请输入使用中心">
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label"> &nbsp;使用项目部</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="text" name="projectDeptId" id="projectDeptId" placeholder="请输入使用项目部">
            </div>
        </div>

        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label"><font
                    color="red">*</font>申请金额</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="text" id="apply_money" name="apply_money" placeholder="请输入申请金额"
                       onchange="getFinanceCost1()">
                <div id="dxMoney"></div>
            </div>
            元
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label"><font
                    color="red">*</font>综合融资成本率（年化）(%)</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="text" id="rate" name="rate" placeholder="请输入综合融资成本率"
                       onchange="getFinanceCost()">
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label"><font
                    color="red">*</font>综合融资成本</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="text" id="finance_cost" name="finance_cost">
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label">融资用途</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="text" id="purpose" name="purpose" placeholder="请输入融资用途">
            </div>
        </div>
        <div class="weui-cells__tips"></div>

        <div class="weui-cells__title">乙方指定账户</div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label"><font
                    color="red">*</font>户名：</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="text" id="yaccount_name" name="yaccount_name" placeholder="请输入户名">
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label"><font
                    color="red">*</font>账号：</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="text" id="yaccount_number" name="yaccount_number" placeholder="请输入账号">
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label"><font
                    color="red">*</font>开户行：</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="text" id="yopen_bank" name="yopen_bank" placeholder="请输入开户行">
            </div>
        </div>

        <div class="weui-cells__title">乙方还款计划明细</div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label"><font
                    color="red">*</font>还款时间：</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="text" class="date" name="yjrepayment_time1" id="yjrepayment_time1"
                       placeholder="请输入还款时间">
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label"><font
                    color="red">*</font>还款金额：</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="text" id="yjrepayment_money1" name="yjrepayment_money1"
                       placeholder="请输入还款金" onchange="getMoney()">
            </div>
        </div>
        <!--<div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label">还款时间2：</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="text" class="date" name="yjrepayment_time2" id="yjrepayment_time2"
                       placeholder="请输入还款时间2">
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label">还款金额2：</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="text" name="yjrepayment_money2"  id="yjrepayment_money2" placeholder="请输入还款金额2">
            </div>
        </div>-->

        <!--上传图片-->
        <div id="img">
            <div class="weui-cell">
                <div class="weui-cell__bd">
                    <div class="weui-uploader">
                        <div class="weui-uploader__hd">
                            <p class="weui-uploader__title"><font
                                    color="red">*</font>图片</p>
                        </div>
                        <div class="weui-uploader__bd">
                            <ul class="weui-uploader__files" id="uploaderFiles">
                            </ul>
                            <div class="weui-uploader__input-box">
                                <input id="uploaderInput" class="weui-uploader__input" type="file" accept="image/*"/>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>


        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label"><font
                    color="red" style="margin-right:10px">*</font>选择上级审核人</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="text" id="dbUser" name="dbUser" placeholder="请选择上级审核人">
            </div>
        </div>
        <input type="hidden" name="token" id="token">
        <div class="weui-btn-area">

            <a class="weui-btn weui-btn_primary" id="conf">提交申请</a>
        </div>
        <input type="hidden" id="imgs" name="imgs"/>
        <input type="hidden" id="imgsname" name="imgsname"/>
        <input type="hidden" name="money" id="money">
        <input type="hidden" name="project_name2" id="project_name2">
        <input type="hidden" name="bh" id="bh">
        <input type="hidden" name="project_name" id="project_name">
        <input type="hidden" name="CSRFToken" id="CSRFToken"/>


    </form>
</div>
<script src="js/jquery-weui.js"></script>
<script src="js/select2.js"></script>
<script src="js/select2_locale_zh-CN.js"></script>
<link rel="stylesheet" href="js/select2.css">
<script type="text/javascript">

    var format = function (time, format) {
        var t = new Date(time);
        var tf = function (i) {
            return (i < 10 ? '0' : '') + i
        };
        return format.replace(/yyyy|MM|dd|HH|mm|ss/g, function (a) {
            switch (a) {
                case 'yyyy':
                    return tf(t.getFullYear());
                    break;
                case 'MM':
                    return tf(t.getMonth() + 1);
                    break;
                case 'mm':
                    return tf(t.getMinutes());
                    break;
                case 'dd':
                    return tf(t.getDate());
                    break;
                case 'HH':
                    return tf(t.getHours());
                    break;
                case 'ss':
                    return tf(t.getSeconds());
                    break;
            }
        })
    }

    $(function () {
        $("#token").val(localStorage.getItem("token"));
        $("#apply_man").val(localStorage.getItem("realname"));
        document.getElementById("name2").style.display = "none";
    })

    $("#CSRFToken").val(localStorage.getItem("csrf"))
    $("#yjrepayment_time2").calendar({});
    $("#yjrepayment_time1").calendar({});


    /*$("#start_time").calendar({
     //value: [format('2017-09-09',"yyyy-MM-dd")]
     });
     $("#end_time").calendar({
     //  value: [format(end_date,"yyyy-MM-dd")]

     });*/


    var tmpl = '<li class="weui-uploader__file" style="background-image:url(#url#)"></li>',
        $uploaderInput = $("#uploaderInput"), $uploaderFiles = $("#uploaderFiles");
    $uploaderInput.on("change", function (e) {
        var src, url = window.URL || window.webkitURL || window.mozURL, files = e.target.files;
        var img = $("#imgs").val();
        var imgname = $("#imgsname").val();
        for (var i = 0, len = files.length; i < len; ++i) {
            var file = files[i];
            lrz(file, {width: 640, quality: 0.9}, function (rst) {
                $("#imgs").val(img + "&" + rst.base64);
                $("#imgsname").val(imgname + "&" + rst.origin.name);

            });
            if (url) {
                src = url.createObjectURL(file);
            } else {
                src = e.target.result;
            }
            if ($uploaderFiles.find(".weui-uploader__file").length > 0) {
                //  $uploaderFiles.find(".weui-uploader__file").css("background-image","url(" + src + ")");
                $uploaderFiles.append("<li class='weui-uploader__file' style='background-image:url(" + src + ")'></li>");

            } else {
                $uploaderFiles.append($(tmpl.replace('#url#', src)));
            }

        }

    })

    $("#bh2").select2({
        placeholder: "请选择合同编号",	//默认文本框显示信息
        minimumInputLength: 0,	//最小输入字符长度
        multiple: false,				//设置多项选择，false则只能单选
        allowClear: true,
        maximumSelectionSize: 5,
        query: function (query) {
            $.ajax({
                type: "POST",
                url: "ccc.do?method=getBh",
                data: {name: query.term},   //传递输入框中的值
                success: function (msg) {
                    var msg = $.parseJSON(msg);
                    var data = {results: []};
                    $.each(msg, function (x, y) {
                        data.results.push({id: y.id, text: y.name});

                    });
                    query.callback(data);
                }
            });
        }
    });


    $("#dbUser").select2({
        placeholder: "请选择上级审核人",	//默认文本框显示信息

        minimumInputLength: 1,	//最小输入字符长度
        multiple: false,				//设置多项选择，false则只能单选
        allowClear: true,
        maximumSelectionSize: 5,
        query: function (query) {
            $.ajax({
                type: "POST",
                url: "rzRelease/getUsers",
                data: {name: query.term},   //传递输入框中的值
                success: function (msg) {
                    var msg = $.parseJSON(msg);
                    var data = {results: []};
                    $.each(msg, function (x, y) {
                        data.results.push({id: y.id, text: y.name});
                    });
                    query.callback(data);
                }
            });
        }
    });

    $("#deptId").select2({
        placeholder: "请输入大区名称", //默认文本框显示信息
        minimumInputLength: 1, //最小输入字符长度
        allowClear: true,
        multiple: false, //设置多项选择，false则只能单选
        maximumSelectionSize: 5, //最大选择个数
        query: function (query) {
            $.ajax({
                type: "POST",
                //url : "insti.do?method=getCurrent",
                url: "login/getDepartment?flag=1",
                data: {
                    dept: query.term
                }, //传递你输入框中的值
                success: function (msg) {
                    var msg = $.parseJSON(msg);
                    var data = {
                        results: []
                    };
                    $.each(msg, function (x, y) {
                        data.results.push({
                            id: y.id,
                            text: y.name
                        });
                        ;
                    });
                    query.callback(data);
                }
            });
        }
    });
    $("#centerId").select2({
        placeholder: "请输入中心名称", //默认文本框显示信息
        minimumInputLength: 0, //最小输入字符长度
        allowClear: true,
        multiple: false, //设置多项选择，false则只能单选
        maximumSelectionSize: 5, //最大选择个数
        query: function (query) {
            $.ajax({
                type: "POST",
                //url : "insti.do?method=getCurrent",
                url: "login/getDepartment?flag=" + 2 + "&fatherId=" + $("#deptId").val(),
                data: {
                    dept: query.term
                }, //传递你输入框中的值
                success: function (msg) {
                    var msg = $.parseJSON(msg);
                    var data = {
                        results: []
                    };
                    $.each(msg, function (x, y) {
                        data.results.push({
                            id: y.id,
                            text: y.name
                        });
                        ;
                    });
                    query.callback(data);
                }
            });
        }
    });
    $("#projectDeptId").select2({
        placeholder: "请输入项目部名称", //默认文本框显示信息
        minimumInputLength: 0, //最小输入字符长度
        allowClear: true,
        multiple: false, //设置多项选择，false则只能单选
        maximumSelectionSize: 5, //最大选择个数
        query: function (query) {
            $.ajax({
                type: "POST",
                //url : "insti.do?method=getCurrent",
                url: "login/getDepartment?flag=" + 3 + "&fatherId=" + $("#centerId").val(),
                data: {
                    name: query.term
                }, //传递你输入框中的值
                success: function (msg) {
                    var msg = $.parseJSON(msg);
                    var data = {
                        results: []
                    };
                    $.each(msg, function (x, y) {
                        data.results.push({
                            id: y.id,
                            text: y.name
                        });
                        ;
                    });
                    query.callback(data);
                }
            });
        }
    });
    $("#conf").click(function () {

        //$("#conf").attr("disabled", true
        var ts1 = 1;
        var ts2 = 2;
        var ts3 = 3;
        var ts4 = 4;
        if ($("#types").val() == 1) {
            if ($("#start_time").val() < $("#time1").val()) {//资金使用起始时间
                ts1 = 11;
            } else {
                ts1 = 1;
            }
            if ($("#end_time").val() > $("#time2").val()) {//资金使用结束时间
                ts2 = 22;
            } else {
                ts2 = 2;
            }
            if (parseFloat($("#money").val()) < parseFloat($("#apply_money").val())) {//申请金额
                ts3 = 33;
            } else {
                ts3 = 3;
            }

            if ($("#project_name").val() != $("#project_name2").val()) {//项目名称
                ts4 = 44;
            } else {
                ts4 = 4;
            }
        }
        if ($("#year").val() != null && $("#year").val() != "" && $("#num1").val() != null && $("#num1").val() != "") {
            $("#bh").val("[" + $("#year").val() + "年]" + "(" + $("#num1").val() + ")号" + "(" + $("#num2").val() + ")号")
        }
        /*if($("#bh").val() !=null && $("#bh").val() !=""){
         }*/ else {
            $("#bh").val($("#bh2").val());
        }
        if($("#bh2s").val()!=""){
            $("#bh2s").val($("#bh2s").val() + "号资金请款单");
        }

        if (validate()) {
          //  $('#conf').unbind("click");//移除click事件
            if ($("#bh").val() != null && $("#bh").val() != "") {
                if ($("#deptId").val() == null || $("#deptId").val() == "") {
                    $.toast('请填写使用部门');
                } else {
                    if ($("#types").val() != 2 && ($("#imgsname").val() == null || $("#imgsname").val() == "")) {
                        $.toast("请上传图片");
                    } else {
                        if (ts1 == 1) {
                            if (ts2 == 2) {
                                if (ts3 == 3) {
                                    if (ts4 == 4) {
                                        if ($("#dbUser").val() != null && $("#dbUser").val() != "") {

                                            $.ajax({
                                                type: "POST",
                                                url: 'rzRelease/searchApply',
                                                data: $('#frmInfo').serialize(),
                                                success: function (msg) {
                                                    if(msg.flag){
                                                        $.ajax({
                                                            type: "POST",
                                                            url: 'rzRelease/insertMoneyApply',
                                                            data: $('#frmInfo').serialize(),
                                                            success: function (msg) {
                                                                $.toast("提交申请成功");
                                                                setTimeout(function () {
                                                                    window.location.href = "approve.html"
                                                                }, 1000);
                                                            }, error: function () {
                                                                $.toast("提交申请失败，请检查网络");
                                                            }
                                                        });
                                                    }else{
                                                        $.toast("合同编号不可重复");

                                                    }

                                                }
                                            });


                                        } else {
                                            $.toast('请选择供应链金融经理审核');
                                        }
                                    } else {
                                        $.toast('请填写合同编号');
                                    }

                                } else {
                                    $.toast('申请金额有误');
                                }
                            } else {
                                $.toast('资金使用结束时间有误');
                            }
                        } else {
                            $.toast('资金使用起始时间有误');
                        }
                    }
                }
            }
            else {
                $.toast('请填写合同编号');
            }
        }

    });
    function getImg() {
        if ($("#types").val() == 0 || $("#types").val() == 2) {
            /*$("#start_time").calendar({

             });
             $("#end_time").calendar({

             });*/
            $("#project_name").val("");
            $("#deptId").select2('data', null);
            $("#centerId").select2('data', null);
            $("#projectDeptId").select2('data', null);
            $("#bh").val("");
            $("#bh2").select2('data', null);
            $("#bh2s").val("");
            $("#start_time").val("");
            $("#end_time").val("");
            $("#time1").val("");
            $("#time2").val("");
            $("#money").val("");
            $("#apply_money").val("");
            $("#dxMoney").html("");
            document.getElementById("name2").style.display = "none";
            document.getElementById("name").style.display = "block";
        } else {

            $("#project_name").val("");
            $("#deptId").select2('data', null);
            $("#centerId").select2('data', null);
            $("#projectDeptId").select2('data', null);
            $("#bh").val("");
            $("#bh2").select2('data', null);
            $("#bh2s").val("");
            $("#start_time").val("");
            $("#end_time").val("");
            $("#time1").val("");
            $("#time2").val("");
            $("#money").val("");
            $("#apply_money").val("");
            $("#dxMoney").html("");
            document.getElementById("name2").style.display = "block";
            document.getElementById("name").style.display = "none";
        }
        if ($("#types").val() == 0 || $("#types").val() == 1) {
            $("#img").removeAttr("style");
            $("#img").css("display", "block");
        } else {
            $("#img").removeAttr("style");
            $("#img").css("display", "none");
        }
    }
    function getFinanceCost() {
        var rate = $("#rate").val();
        var start_time = $("#start_time").val()
        var end_time = $("#end_time").val()
        var money = $("#apply_money").val();
        if (rate != "" && start_time != "" && end_time != "" && money != "") {

            var day = parseInt(Math.abs(new Date(start_time) - new Date(end_time)) / 1000 / 60 / 60 / 24);
            var a = (day * (rate / 100) * money / 360).toFixed(2);
            $("#finance_cost").val(a);
            $("#yjrepayment_money1").val(Number(money) + Number(a));

        }
    }
    function convertCurrency(money) {
        //汉字的数字
        var cnNums = new Array('零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖');
        //基本单位
        var cnIntRadice = new Array('', '拾', '佰', '仟');
        //对应整数部分扩展单位
        var cnIntUnits = new Array('', '万', '亿', '兆');
        //对应小数部分单位
        var cnDecUnits = new Array('角', '分', '毫', '厘');
        //整数金额时后面跟的字符
        var cnInteger = '整';
        //整型完以后的单位
        var cnIntLast = '元';
        //最大处理的数字
        var maxNum = 999999999999999.9999;
        //金额整数部分
        var integerNum;
        //金额小数部分
        var decimalNum;
        //输出的中文金额字符串
        var chineseStr = '';
        //分离金额后用的数组，预定义
        var parts;
        if (money == '') {
            return '';
        }
        money = parseFloat(money);
        if (money >= maxNum) {
            //超出最大处理数字
            return '';
        }
        if (money == 0) {
            chineseStr = cnNums[0] + cnIntLast + cnInteger;
            return chineseStr;
        }
        //转换为字符串
        money = money.toString();
        if (money.indexOf('.') == -1) {
            integerNum = money;
            decimalNum = '';
        } else {
            parts = money.split('.');
            integerNum = parts[0];
            decimalNum = parts[1].substr(0, 4);
        }
        //获取整型部分转换
        if (parseInt(integerNum, 10) > 0) {
            var zeroCount = 0;
            var IntLen = integerNum.length;
            for (var i = 0; i < IntLen; i++) {
                var n = integerNum.substr(i, 1);
                var p = IntLen - i - 1;
                var q = p / 4;
                var m = p % 4;
                if (n == '0') {
                    zeroCount++;
                } else {
                    if (zeroCount > 0) {
                        chineseStr += cnNums[0];
                    }
                    //归零
                    zeroCount = 0;
                    chineseStr += cnNums[parseInt(n)] + cnIntRadice[m];
                }
                if (m == 0 && zeroCount < 4) {
                    chineseStr += cnIntUnits[q];
                }
            }
            chineseStr += cnIntLast;
        }
        //小数部分
        if (decimalNum != '') {
            var decLen = decimalNum.length;
            for (var i = 0; i < decLen; i++) {
                var n = decimalNum.substr(i, 1);
                if (n != '0') {
                    chineseStr += cnNums[Number(n)] + cnDecUnits[i];
                }
            }
        }
        if (chineseStr == '') {
            chineseStr += cnNums[0] + cnIntLast + cnInteger;
        } else if (decimalNum == '') {
            chineseStr += cnInteger;
        }
        $("#dxMoney").html("(" + chineseStr + ")")
        // return chineseStr;
    }


    function getFinanceCost1() {
        getFinanceCost();
        convertCurrency($("#apply_money").val());
    }
    function getMoney() {
        var yjrepayment_money1 = $("#yjrepayment_money1").val()
        var yjrepayment_money2 = $("#yjrepayment_money2").val()
        var apply_money = $("#apply_money").val();
    }
    function getTime() {
        $("#start_time").calendar({
            //value: [format('2017-09-09',"yyyy-MM-dd")]
        });
        $("#end_time").calendar({
            //  value: [format(end_date,"yyyy-MM-dd")]

        });
    }
    function getName() {


        $.ajax({
            type: "POST",
            url: 'ccc.do?method=getBh2',
            data: {name: $("#bh2").val()},
            success: function (msg) {
                console.info();


                $("#project_name2").val(msg.project_namegd2);
                $("#project_name").val(msg.project_namegd2);
                $("#start_time").val(msg.start_time);
                $("#end_time").val(msg.end_time);
                $("#time1").val(msg.start_time);
                $("#time2").val(msg.end_time);
                $("#money").val(msg.apply_money);
                $("#apply_money").val(msg.apply_money);
                $("#rate").val(msg.rate * 100);

                $("#start_time").calendar({
                    value: [format(msg.start_time, "yyyy-MM-dd")],
                    minDate: [format(msg.start_time, "yyyy-MM-dd")],
                    maxDate: [format(msg.end_time, "yyyy-MM-dd")]
                    //  dateFormat: 'yyyy-mm-dd'
                });
                $("#end_time").calendar({
                    value: [format(msg.end_time, "yyyy-MM-dd")],
                    minDate: [format(msg.start_time, "yyyy-MM-dd")],
                    maxDate: [format(msg.end_time, "yyyy-MM-dd")]
                    //  dateFormat: 'yyyy-mm-dd'
                });
                if (msg.deptName != null && msg.deptName != "") {

                } else {
                    msg.deptName = "";
                }
                if (msg.centerName != null && msg.centerName != "") {

                } else {
                    msg.centerName = "";
                }
                if (msg.projectDeptName != null && msg.projectDeptName != "") {

                } else {
                    msg.projectDeptName = "";
                }
                $("#deptId").select2("data", {id: msg.deptId, text: msg.deptname});
                $("#centerId").select2("data", {id: msg.centerId, text: msg.centerName});
                $("#projectDeptId").select2("data", {id: msg.projectDeptId, text: msg.projectDeptName});
                getFinanceCost1();
            }
        })
    }


</script>
<script src="js/web/checkLogin.js"></script>
</body>
</html>